/*    */ package com.zimbra.cs.service.admin;
/*    */ 
/*    */ import com.zimbra.common.account.Key.ServerBy;
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.soap.AdminConstants;
/*    */ import com.zimbra.common.soap.Element;
/*    */ import com.zimbra.cs.account.Provisioning;
/*    */ import com.zimbra.cs.account.Server;
/*    */ import com.zimbra.cs.account.accesscontrol.AdminRight;
/*    */ import com.zimbra.cs.account.accesscontrol.Rights.Admin;
/*    */ import com.zimbra.cs.rmgmt.RemoteManager;
/*    */ import com.zimbra.soap.ZimbraSoapContext;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class MailQueueFlush
/*    */   extends AdminDocumentHandler
/*    */ {
/*    */   public Element handle(Element request, Map<String, Object> context)
/*    */     throws ServiceException
/*    */   {
/* 38 */     ZimbraSoapContext zsc = getZimbraSoapContext(context);
/* 39 */     Provisioning prov = Provisioning.getInstance();
/*    */     
/* 41 */     Element serverElem = request.getElement("server");
/* 42 */     String serverName = serverElem.getAttribute("name");
/*    */     
/* 44 */     Server server = prov.get(Key.ServerBy.name, serverName);
/* 45 */     if (server == null) {
/* 46 */       throw ServiceException.INVALID_REQUEST("server with name " + serverName + " could not be found", null);
/*    */     }
/*    */     
/* 49 */     checkRight(zsc, context, server, Rights.Admin.R_manageMailQueue);
/*    */     
/* 51 */     RemoteManager rmgr = RemoteManager.getRemoteManager(server);
/* 52 */     rmgr.execute("flushqueue");
/* 53 */     Element response = zsc.createElement(AdminConstants.MAIL_QUEUE_FLUSH_RESPONSE);
/* 54 */     return response;
/*    */   }
/*    */   
/*    */   public void docRights(List<AdminRight> relatedRights, List<String> notes)
/*    */   {
/* 59 */     relatedRights.add(Rights.Admin.R_manageMailQueue);
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/admin/MailQueueFlush.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */